<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background: #000;
        }
    </style>
</head>

<body>
    <div></div>
    <button>点小姐姐</button>
    <button>点小哥哥</button>
</body>
<script>
    var btn2obj = document.querySelector('button:nth-of-type(2)');
    btn2obj.onclick = function () {
        document.querySelector('div').onclick = null;
    }
    var btn1obj = document.querySelector('button:nth-of-type(1)');
    console.log(btn1obj);

    btn1obj.onclick = function () {

        document.querySelector('div').onclick = function () {
            alert('hello')
        }
    }
</script>

</html>